#include "quill/Quill.h"

int main() {
  quill::configure([]() {
    quill::Config cfg;
    return cfg;
  }());

  quill::start();

  quill::Logger *logger = quill::create_logger(
      "file_logger", quill::file_handler("example.log", []() {
        quill::FileHandlerConfig cfg;
        cfg.set_open_mode('w');
        cfg.set_pattern(
            "[%(time)] [%(thread_id)] [%(file_name):%(line_number)] "
            "[%(logger)] " // Changed %(thread) to %(thread_id)
            "[%(log_level)] - %(message)",
            "%H:%M:%S.%Qms");
        return cfg;
      }()));

  logger->set_log_level(quill::LogLevel::TraceL3);
  logger->init_backtrace(2u, quill::LogLevel::Critical);

  LOG_BACKTRACE(logger, "Backtrace log {}", 1);
  LOG_BACKTRACE(logger, "Backtrace log {}", 2);

  LOG_INFO(logger, "Welcome to Quill!");
  LOG_ERROR(logger, "An error message. error code {}", 123);
  LOG_WARNING(logger, "A warning message.");
  LOG_CRITICAL(logger, "A critical error.");
  LOG_DEBUG(logger, "Debugging foo {}", 1234);
  LOG_TRACE_L1(logger, "{:>30}", "right aligned");
  LOG_TRACE_L2(logger, "Positional arguments are {1} {0} ", "too", "supported");
  LOG_TRACE_L3(logger, "Support for floats {:03.2f}", 1.23456);
}